package a.j;

import java.awt.*;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.util.HashMap;

public class gc
  implements Printable
{
  public static final byte a = 0;
  public static final byte b = 1;
  private pg c;
  private int d = 1;
  private int e = 1;
  private byte f = 1;
  private boolean g = false;
  private double h = 1.0D;
  private byte i = 0;
  private RenderingHints j;
  private boolean k = true;
  j_ l;
  h_ m;
  byte n;
  Rectangle2D o;
  public static final byte p = 0;
  public static final byte q = 1;
  public static final byte r = 0;
  public static final byte s = 1;
  public static final byte t = 2;
  public static boolean u;
  
  public gc(pg parampg)
  {
    this.c = parampg;
    this.l = new f_();
    this.j = new RenderingHints(new HashMap());
    this.j.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    this.n = 0;
  }
  
  public void a(boolean paramBoolean)
  {
    this.g = paramBoolean;
  }
  
  public boolean a()
  {
    return this.g;
  }
  
  public void b(boolean paramBoolean)
  {
    this.k = paramBoolean;
  }
  
  public boolean b()
  {
    return this.k;
  }
  
  public void a(int paramInt)
  {
    this.d = paramInt;
  }
  
  public void b(int paramInt)
  {
    this.e = paramInt;
  }
  
  public int c()
  {
    return this.d;
  }
  
  public int d()
  {
    return this.e;
  }
  
  public void a(byte paramByte)
  {
    this.f = paramByte;
  }
  
  public byte e()
  {
    return this.f;
  }
  
  public void a(double paramDouble)
  {
    this.h = paramDouble;
  }
  
  public double f()
  {
    return this.h;
  }
  
  public void b(byte paramByte)
  {
    this.i = paramByte;
  }
  
  public byte g()
  {
    return this.i;
  }
  
  public void a(Rectangle2D paramRectangle2D)
  {
    this.o = paramRectangle2D;
  }
  
  public Rectangle2D h()
  {
    return this.o;
  }
  
  public byte i()
  {
    return this.n;
  }
  
  public void c(byte paramByte)
  {
    if (!ld.E) {}
    switch (paramByte)
    {
    case 0: 
    case 1: 
      this.n = paramByte;
      if (!ld.D) {
        break;
      }
    default: 
      throw new IllegalArgumentException("Not a valid type for title and footer.");
    }
  }
  
  public int print(Graphics paramGraphics, PageFormat paramPageFormat, int paramInt)
    throws PrinterException
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    Graphics2D localGraphics2D = (Graphics2D)paramGraphics.create();
    localGraphics2D.addRenderingHints(this.j);
    try
    {
      AffineTransform localAffineTransform = localGraphics2D.getTransform();
      Shape localShape = localGraphics2D.getClip();
      if (localShape == null) {
        throw new IllegalArgumentException("Graphics.getClip() must be non-null!");
      }
      double d1 = paramPageFormat.getImageableX();
      double d2 = paramPageFormat.getImageableY();
      double d3 = paramPageFormat.getImageableWidth();
      double d4 = paramPageFormat.getImageableHeight();
      Rectangle localRectangle1 = j();
      double d5 = localRectangle1.getWidth();
      double d6 = localRectangle1.getHeight();
      double d7 = localRectangle1.getX();
      double d8 = localRectangle1.getY();
      double d9 = 0.0D;
      double d10 = 0.0D;
      i_ locali_1;
      if (!bool2) {
        if (this.l != null)
        {
          locali_1 = new i_();
          locali_1.c = localGraphics2D;
          locali_1.d = paramInt;
          locali_1.a = paramPageFormat;
          locali_1.j = this.e;
          locali_1.i = this.d;
          locali_1.f = (paramInt % this.e);
          locali_1.g = (paramInt / this.e);
          this.l.a(locali_1);
          d9 = this.l.getBounds().getHeight();
        }
      }
      if (!bool2) {
        if (this.m != null)
        {
          locali_1 = new i_();
          locali_1.c = localGraphics2D;
          locali_1.d = paramInt;
          locali_1.a = paramPageFormat;
          locali_1.j = this.e;
          locali_1.i = this.d;
          locali_1.f = (paramInt % this.e);
          locali_1.g = (paramInt / this.e);
          this.m.a(locali_1);
          d10 = this.m.getBounds().getHeight();
        }
      }
      double d12;
      double d13;
      int i2;
      int i1;
      double d11;
      switch (this.i)
      {
      case 1: 
        d12 = d5 * this.h;
        d13 = d6 * this.h;
        i2 = (int)Math.ceil(d12 / d3 - 0.01D);
        i1 = (int)Math.ceil(d13 / d4 - 0.01D);
        d11 = this.h;
        d12 = d3 * i2;
        if (!bool2)
        {
          if (i() == 1)
          {
            d13 = d4 * i1 - d9 * i1 - d10 * i1;
            if (bool2) {
              break label649;
            }
            if (!bool1) {
              break;
            }
          }
          else
          {
            d13 = d4 * i1 - d9 - d10;
          }
        }
        else
        {
          if (bool2) {
            break label649;
          }
          if (!bool1) {
            break;
          }
        }
        break;
      case 0: 
        i2 = this.e;
        i1 = this.d;
        d12 = d3 * i2;
        if (i() == 1)
        {
          d13 = d4 * i1 - d9 * i1 - d10 * i1;
          if (bool2) {
            break label581;
          }
          if (!bool1) {}
        }
        else
        {
          d13 = d4 * i1 - d9 - d10;
        }
        if (!bool2) {
          if (d12 / d13 > d5 / d6)
          {
            d11 = d13 / d6;
            if (bool2) {
              break label649;
            }
            if (!bool1) {
              break;
            }
          }
        }
        d11 = d12 / d5;
        if (!bool2) {
          if (!bool1) {
            break;
          }
        }
        break;
      default: 
        label581:
        throw new RuntimeException("Undefined ScalingType: " + this.i);
      }
      label649:
      if (!bool2) {
        if (paramInt >= i1 * i2)
        {
          i3 = 1;
          return i3;
        }
      }
      int i3 = paramInt % i2;
      int i4 = paramInt / i2;
      double d14 = 0.0D;
      double d15 = 0.0D;
      if (!bool2) {
        if (this.k)
        {
          d14 = Math.max(0.0D, (d12 - d5 * d11) / 2.0D);
          d15 = Math.max(0.0D, (d13 - d6 * d11) / 2.0D);
        }
      }
      if ((bool2) || (i() == 1))
      {
        int i5 = (int)Math.ceil(d1);
        int i6 = (int)Math.ceil(d2 + d9);
        int i7 = (int)Math.floor(d1 + d3);
        int i8 = (int)Math.floor(d2 + d4 - d10);
        localGraphics2D.clipRect(i5, i6, i7 - i5, i8 - i6);
        localGraphics2D.translate(d1 + d14 - d7 * d11 - d3 * i3, d2 + d15 - d8 * d11 - d4 * i4 + d9 * (i4 + 1) + d10 * i4);
        if (bool2) {
          break label935;
        }
        if (!bool1) {}
      }
      else
      {
        localGraphics2D.translate(d1 + d14 - d7 * d11 - d3 * i3, d2 + d15 - d8 * d11 - d4 * i4 + d9);
      }
      localGraphics2D.scale(d11, d11);
      label935:
      Rectangle localRectangle2 = new Rectangle(localRectangle1);
      Rectangle localRectangle3 = localGraphics2D.getClipBounds();
      Rectangle localRectangle4 = localRectangle3.intersection(localRectangle2);
      localGraphics2D.clip(localRectangle4);
      pc localpc = a(this.c, localGraphics2D);
      if (!bool2)
      {
        if (localpc != null) {
          localGraphics2D.setRenderingHint(kg.z, localpc);
        }
        this.c.Y().a(localGraphics2D, localRectangle4.x, localRectangle4.y, localRectangle4.width, localRectangle4.height);
        this.c.c(localGraphics2D);
      }
      hc localhc = this.c.W();
      localhc.a(localGraphics2D, this.c.a());
      this.c.b(localGraphics2D);
      localGraphics2D.setTransform(localAffineTransform);
      localGraphics2D.setClip(localShape);
      localGraphics2D.setColor(Color.black);
      if (!bool2) {
        if (a())
        {
          i_ locali_2 = new i_();
          locali_2.c = localGraphics2D;
          locali_2.d = paramInt;
          locali_2.a = paramPageFormat;
          locali_2.j = i2;
          locali_2.i = i1;
          locali_2.f = (paramInt % i2);
          locali_2.g = (paramInt / i2);
          a(localGraphics2D, locali_2);
        }
      }
      if (!bool2) {
        if (this.l != null) {
          this.l.paint(localGraphics2D);
        }
      }
      if ((bool2) || (this.m != null)) {
        this.m.paint(localGraphics2D);
      }
      int i9 = 0;
      return i9;
    }
    finally
    {
      localGraphics2D.dispose();
    }
  }
  
  protected void a(Graphics2D paramGraphics2D, i_ parami_)
  {
    Color localColor = paramGraphics2D.getColor();
    Font localFont = paramGraphics2D.getFont();
    b(paramGraphics2D, parami_);
    PageFormat localPageFormat = parami_.e();
    int i1 = (int)localPageFormat.getImageableX() + 15;
    int i2 = (int)localPageFormat.getImageableY() + 15;
    int i3 = parami_.a() + 1;
    int i4 = parami_.c() + 1;
    TextLayout localTextLayout = new TextLayout("[" + i3 + ',' + i4 + "]", paramGraphics2D.getFont(), paramGraphics2D.getFontRenderContext());
    paramGraphics2D.setColor(Color.white);
    Rectangle2D localRectangle2D = localTextLayout.getBounds();
    localRectangle2D.setRect(localRectangle2D.getX() + i1 - 2.0D, localRectangle2D.getY() + i2 - 2.0D, localRectangle2D.getWidth() + 4.0D, localRectangle2D.getHeight() + 4.0D);
    paramGraphics2D.fill(localRectangle2D);
    paramGraphics2D.setColor(Color.black);
    localTextLayout.draw(paramGraphics2D, i1, i2);
    paramGraphics2D.setFont(localFont);
    paramGraphics2D.setColor(localColor);
  }
  
  protected void b(Graphics2D paramGraphics2D, i_ parami_)
  {
    Font localFont = paramGraphics2D.getFont();
    if (localFont.getSize() != 11) {
      paramGraphics2D.setFont(localFont.deriveFont(11.0F));
    }
  }
  
  public Dimension a(PageFormat paramPageFormat)
  {
    Rectangle localRectangle = j();
    double d1 = localRectangle.getWidth() * this.h;
    double d2 = localRectangle.getHeight() * this.h;
    this.e = ((int)Math.ceil(d1 / paramPageFormat.getImageableWidth()));
    this.d = ((int)Math.ceil(d2 / paramPageFormat.getImageableHeight()));
    return new Dimension(this.e, this.d);
  }
  
  Rectangle j()
  {
    boolean bool = ld.E;
    Rectangle localRectangle = null;
    if (!bool)
    {
      switch (e())
      {
      case 0: 
        localRectangle = this.c.getVisibleRect();
        break;
      case 2: 
        if (!bool) {
          if (this.o == null) {
            throw new IllegalArgumentException("custom clip not set");
          }
        }
        localRectangle = this.o.getBounds();
        break;
      }
    }
    else
    {
      localRectangle = this.c.a().d();
      localRectangle.setFrame(localRectangle.x - 2, localRectangle.y - 2, localRectangle.width + 4, localRectangle.height + 4);
    }
    return localRectangle;
  }
  
  protected pc a(pg parampg, Graphics2D paramGraphics2D)
  {
    if (paramGraphics2D.getRenderingHint(kg.z) == null)
    {
      pc localpc = new pc();
      localpc.a(true);
      localpc.a(parampg);
      Point2D localPoint2D = parampg.S();
      AffineTransform localAffineTransform = paramGraphics2D.getTransform();
      localAffineTransform.translate(localPoint2D.getX(), localPoint2D.getY());
      double d1 = 1.0D / parampg.M();
      localAffineTransform.scale(d1, d1);
      localpc.a(localAffineTransform);
      return localpc;
    }
    return null;
  }
  
  public void a(j_ paramj_)
  {
    this.l = paramj_;
  }
  
  public j_ k()
  {
    return this.l;
  }
  
  public void a(h_ paramh_)
  {
    this.m = paramh_;
  }
  
  public h_ l()
  {
    return this.m;
  }
  
  public void a(RenderingHints paramRenderingHints)
  {
    if (paramRenderingHints == null) {
      throw new IllegalArgumentException("RenderingHints cannot be null");
    }
    this.j = paramRenderingHints;
  }
  
  public RenderingHints m()
  {
    return this.j;
  }
  
  public static class g_
    extends gc.e_
  {
    public static int j;
    
    void a()
    {
      boolean bool2 = ld.E;
      boolean bool1 = ld.D;
      this.f.setFrame(0.0D, 0.0D, 0.0D, 0.0D);
      if (((bool2) || (this.a != null)) && (!"".equals(this.a)))
      {
        this.e = new TextLayout(this.a, this.b, this.d.c.getFontRenderContext());
        double d1 = this.e.getBounds().getHeight() + 20.0D;
        Paper localPaper = this.d.a.getPaper();
        if (!bool2) {
          if (this.d.a.getOrientation() == 1)
          {
            this.f = new Rectangle2D.Double(localPaper.getImageableX(), localPaper.getImageableY(), localPaper.getImageableWidth(), d1);
            if ((!bool2) && (!bool1)) {
              return;
            }
          }
        }
        double d2;
        double d3;
        if (!bool2) {
          if (this.d.a.getOrientation() == 0)
          {
            d2 = localPaper.getHeight() - localPaper.getImageableY() - localPaper.getImageableHeight();
            d3 = localPaper.getImageableX();
            this.f = new Rectangle2D.Double(d2, d3, localPaper.getImageableHeight(), d1);
            if ((!bool2) && (!bool1)) {
              return;
            }
          }
        }
        if (this.d.a.getOrientation() == 2)
        {
          d2 = localPaper.getImageableY();
          d3 = localPaper.getWidth() - localPaper.getImageableX() - localPaper.getImageableWidth();
          this.f = new Rectangle2D.Double(d2, d3, localPaper.getImageableHeight(), d1);
        }
      }
    }
  }
  
  public static class f_
    extends gc.e_
  {
    public static int j;
    
    void a()
    {
      boolean bool2 = ld.E;
      boolean bool1 = ld.D;
      this.f.setFrame(0.0D, 0.0D, 0.0D, 0.0D);
      if (((bool2) || (this.a != null)) && (!"".equals(this.a)))
      {
        this.e = new TextLayout(this.a, this.b, this.d.c.getFontRenderContext());
        double d1 = this.e.getBounds().getHeight() + 20.0D;
        Paper localPaper = this.d.a.getPaper();
        if (!bool2) {
          if (this.d.a.getOrientation() == 1)
          {
            this.f = new Rectangle2D.Double(localPaper.getImageableX(), localPaper.getImageableY(), localPaper.getImageableWidth(), d1);
            if (bool2) {
              break label337;
            }
            if (!bool1) {
              break label284;
            }
          }
        }
        double d2;
        double d3;
        if (!bool2)
        {
          if (this.d.a.getOrientation() == 0)
          {
            d2 = localPaper.getHeight() - localPaper.getImageableY() - localPaper.getImageableHeight();
            d3 = localPaper.getImageableX();
            this.f = new Rectangle2D.Double(d2, d3, localPaper.getImageableHeight(), d1);
            if (bool2) {
              break label337;
            }
            if (!bool1) {}
          }
          else
          {
            if (bool2) {
              break label338;
            }
          }
        }
        else if (this.d.a.getOrientation() == 2)
        {
          d2 = localPaper.getImageableY();
          d3 = localPaper.getWidth() - localPaper.getImageableX() - localPaper.getImageableWidth();
          this.f = new Rectangle2D.Double(d2, d3, localPaper.getImageableHeight(), d1);
        }
        label284:
        this.f.x -= this.d.f * this.f.width;
        this.f.y -= this.d.g * localPaper.getImageableHeight();
        label337:
        label338:
        this.f.width *= this.d.j;
      }
    }
  }
  
  public static abstract class e_
    extends gc.a_
  {
    Color h = Color.lightGray;
    public static int i;
    
    public void paint(Graphics2D paramGraphics2D)
    {
      boolean bool = ld.E;
      a();
      if (!bool) {
        if (this.h != null)
        {
          paramGraphics2D.setColor(this.h);
          paramGraphics2D.fill(this.f);
        }
      }
      if ((bool) || (this.c != null)) {
        if (!bool)
        {
          if (this.e != null) {
            paramGraphics2D.setColor(this.c);
          }
        }
        else
        {
          Rectangle2D localRectangle2D = this.e.getBounds();
          this.e.draw(paramGraphics2D, (float)(this.f.x + (this.f.width - localRectangle2D.getWidth()) / 2.0D), (float)(this.f.y - localRectangle2D.getY() + (this.f.height - localRectangle2D.getHeight()) / 2.0D));
        }
      }
    }
    
    public Color f()
    {
      return this.h;
    }
    
    public void b(Color paramColor)
    {
      this.h = paramColor;
    }
  }
  
  public static class d_
    extends gc.b_
  {
    public static boolean j;
    
    void a()
    {
      boolean bool2 = ld.E;
      boolean bool1 = ld.D;
      this.f.setFrame(0.0D, 0.0D, 0.0D, 0.0D);
      if (((bool2) || (this.a != null)) && (!"".equals(this.a)))
      {
        this.e = new TextLayout(this.a, this.b, this.d.c.getFontRenderContext());
        double d1 = this.e.getBounds().getHeight() + 20.0D;
        Paper localPaper = this.d.a.getPaper();
        if (!bool2) {
          if (this.d.a.getOrientation() == 1)
          {
            this.f = new Rectangle2D.Double(localPaper.getImageableX(), localPaper.getImageableY() + localPaper.getImageableHeight() - d1, localPaper.getImageableWidth(), d1);
            if ((!bool2) && (!bool1)) {
              return;
            }
          }
        }
        double d2;
        double d3;
        if (!bool2) {
          if (this.d.a.getOrientation() == 0)
          {
            d2 = localPaper.getHeight() - localPaper.getImageableY() - localPaper.getImageableHeight();
            d3 = localPaper.getImageableX() + localPaper.getImageableWidth() - d1;
            this.f = new Rectangle2D.Double(d2, d3, localPaper.getImageableHeight(), d1);
            if ((!bool2) && (!bool1)) {
              return;
            }
          }
        }
        if (this.d.a.getOrientation() == 2)
        {
          d2 = localPaper.getImageableY();
          d3 = localPaper.getWidth() - localPaper.getImageableX() - d1;
          this.f = new Rectangle2D.Double(d2, d3, localPaper.getImageableHeight(), d1);
        }
      }
    }
  }
  
  public static class c_
    extends gc.b_
  {
    public static boolean j;
    
    void a()
    {
      boolean bool2 = ld.E;
      boolean bool1 = ld.D;
      this.f.setFrame(0.0D, 0.0D, 0.0D, 0.0D);
      if (((bool2) || (this.a != null)) && (!"".equals(this.a)))
      {
        this.e = new TextLayout(this.a, this.b, this.d.c.getFontRenderContext());
        double d1 = this.e.getBounds().getHeight() + 20.0D;
        Paper localPaper = this.d.a.getPaper();
        if (!bool2) {
          if (this.d.a.getOrientation() == 1)
          {
            this.f = new Rectangle2D.Double(localPaper.getImageableX(), localPaper.getImageableY() + localPaper.getImageableHeight() - d1, localPaper.getImageableWidth(), d1);
            this.f.y += (this.d.i - this.d.g - 1) * localPaper.getImageableHeight();
            if (bool2) {
              break label428;
            }
            if (!bool1) {
              break label400;
            }
          }
        }
        double d2;
        double d3;
        if (!bool2)
        {
          if (this.d.a.getOrientation() == 0)
          {
            d2 = localPaper.getHeight() - localPaper.getImageableY() - localPaper.getImageableHeight();
            d3 = localPaper.getImageableX() + localPaper.getImageableWidth() - d1;
            this.f = new Rectangle2D.Double(d2, d3, localPaper.getImageableHeight(), d1);
            this.f.y += (this.d.i - this.d.g - 1) * localPaper.getImageableWidth();
            if (bool2) {
              break label428;
            }
            if (!bool1) {}
          }
          else
          {
            if (bool2) {
              break label429;
            }
          }
        }
        else if (this.d.a.getOrientation() == 2)
        {
          d2 = localPaper.getImageableY();
          d3 = localPaper.getWidth() - localPaper.getImageableX() - d1;
          this.f = new Rectangle2D.Double(d2, d3, localPaper.getImageableHeight(), d1);
          this.f.y += (this.d.i - this.d.g - 1) * localPaper.getImageableWidth();
        }
        label400:
        this.f.x -= this.d.f * this.f.width;
        label428:
        label429:
        this.f.width *= this.d.j;
      }
    }
  }
  
  public static abstract class b_
    extends gc.a_
  {
    Color h = Color.lightGray;
    public static int i;
    
    public void paint(Graphics2D paramGraphics2D)
    {
      boolean bool = ld.E;
      a();
      if (!bool) {
        if (this.h != null)
        {
          paramGraphics2D.setColor(this.h);
          paramGraphics2D.fill(this.f);
        }
      }
      if ((bool) || (this.c != null)) {
        if (!bool)
        {
          if (this.e != null) {
            paramGraphics2D.setColor(this.c);
          }
        }
        else
        {
          Rectangle2D localRectangle2D = this.e.getBounds();
          this.e.draw(paramGraphics2D, (float)(this.f.x + (this.f.width - localRectangle2D.getWidth()) / 2.0D), (float)(this.f.y - localRectangle2D.getY() + (this.f.height - localRectangle2D.getHeight()) / 2.0D));
        }
      }
    }
    
    public Color f()
    {
      return this.h;
    }
    
    public void b(Color paramColor)
    {
      this.h = paramColor;
    }
  }
  
  public static abstract class a_
    implements gc.h_, gc.j_
  {
    String a = "";
    Font b = new Font("Dialog", 0, 24);
    Color c = Color.black;
    gc.i_ d;
    TextLayout e;
    Rectangle2D.Double f = new Rectangle2D.Double();
    public static int g;
    
    public void a(gc.i_ parami_)
    {
      this.d = parami_;
    }
    
    public abstract void paint(Graphics2D paramGraphics2D);
    
    public Rectangle getBounds()
    {
      a();
      return this.f.getBounds();
    }
    
    abstract void a();
    
    public Font b()
    {
      return this.b;
    }
    
    public void a(Font paramFont)
    {
      this.b = paramFont;
    }
    
    public gc.i_ c()
    {
      return this.d;
    }
    
    public void b(gc.i_ parami_)
    {
      this.d = parami_;
    }
    
    public String d()
    {
      return this.a;
    }
    
    public void a(String paramString)
    {
      this.a = paramString;
    }
    
    public Color e()
    {
      return this.c;
    }
    
    public void a(Color paramColor)
    {
      this.c = paramColor;
    }
  }
  
  public static abstract interface h_
    extends qb
  {
    public abstract void a(gc.i_ parami_);
  }
  
  public static abstract interface j_
    extends qb
  {
    public abstract void a(gc.i_ parami_);
  }
  
  public static class i_
  {
    PageFormat a;
    Graphics2D c;
    int d;
    int f;
    int g;
    int i;
    int j;
    public static int k;
    
    public int a()
    {
      return this.f;
    }
    
    public int b()
    {
      return this.d;
    }
    
    public int c()
    {
      return this.g;
    }
    
    public Graphics2D d()
    {
      return this.c;
    }
    
    public PageFormat e()
    {
      return this.a;
    }
    
    public int f()
    {
      return this.j;
    }
    
    public int g()
    {
      return this.i;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.gc

 * JD-Core Version:    0.7.0.1

 */